home *** CD-ROM | disk | FTP | other *** search
- /* $VER: AutoPage.rexx v0.6, 01 Feb 1998
- ** Program to automatically collect html pages specified in a list
- ** Requires: HTTPJ 2.00 by Piergiorgio Ghezzo, rexxsupport.library
- ** Limitations: Only http protocol, FULL file name & path <- IMPORTANT!
- ** Author: Arne Seime <aseime@iname.com>
- ** Sitelist is arranged like this: URL IMAGES SHOW
- ** CHANGES SINCE 0.4:
- ** - Added progdir so script can be run from any path, not just current dir.
- ** - Fixed a time convertion bug that occured if a disk file was dated
- ** xx:00:xx. Strange I didn't discovered it before :)
- ** - The result page are temporary stored in ram to keep disk fragmentation down.
- ** - sitelist.txt was not closed when exiting.
- ** - Added possibility to recieve several pages at a time.
- ** - Added a prefs file - a few more options.
- */
- SIGNAL ON BREAK_C;options results;call addlib('rexxsupport.library',0,-30);if open(prefs,"env:autopage.prefs") then;do;savedir = word(readln(prefs),1);progdir = word(readln(prefs),1);max_con = word(readln(prefs),1);loop_delay = word(readln(prefs),1);buffers = word(readln(prefs),1);call setclip(ap_buffers,buffers);call setclip(ap_savedir,savedir);call setclip(ap_progdir,progdir);call close(prefs);end;else;do;Say "Unable to open prefs file.";Say "If you don't have one, type the following into your favourite text editor:";Say "<savedir> /* Directory to save pages in*/";Say "<progdir> /* Directory where program files are located */";Say "<connections> /* Number of connections to run at the same time */";Say "<loop delay> /* Time in 1/50 sec. Time to wait for ready connection */";Say "<buffers> /* Download buffer in kb each connection */";Exit;end;id = 0;do id=1 to max_con;address command "run >NIL: rx httpj.rexx" id;call setclip("HTTPJ." || id,0);address command 'waitforport' "HTTPJ." || id;end;id = 0;line = 0;if ~exists(progdir || sitelist.txt) then;do;Say 'Unable to open sitelist.txt. Exiting.';Exit;end;ok = open(list,progdir || 'sitelist.txt',R);do while ~eof(list);images = '';line = line + 1;id = id+1;rcd = readln(list);if rcd = '' then break;do r=1;if getclip("HTTPJ." || id) = 0 then;do;httpj_address = "HTTPJ." || id;address value httpj_address;line rcd;id = 0;leave r;end;id = id+1;if id > max_con then id = 1;call delay(loop_delay);end;end;do f=1 to max_con;httpj_address = "HTTPJ." || f;address value httpj_address;close;end;ok = open(outpage,'T:_autopage_temp_index.html',W);call writeln(outpage,'<HTML><HEAD><TITLE>Pages collected on' date() || ',' time() '</TITLE></HEAD><!-- Page made by AutoPage.rexx, © Arne Seime <aseime@iname.com> 1998 --><BODY BGCOLOR='WHITE'><BR><CENTER><H2>Pages collected on ' date()', 'time()':</H2><BR><TABLE CELLSPACING=5><TR BGCOLOR='RED'><TD>STATUS</TD><TD>ADDRESS</TD><TD>DATE</TD><TD>TIME</TD></TR>');do o = 1 to (line-1);if open(temp,"T:autopage_temp." || o) then;do;data = readln(temp);call writeln(outpage,data);call close(temp);end;end;call writeln(outpage,'<BR></BODY></HTML>');call close(outpage);call close(list);address command 'copy T:_autopage_temp_index.html to' savedir || 'index.html QUIET';if exists('T:_autopage_temp_index.html') then address command 'delete T:_autopage_temp_index.html QUIET';if exists('T:_httpj_temp.1') then address command 'delete >NIL: T:_httpj_temp.#?';if exists('T:autopage_temp.1') then address command 'delete >NIL: T:autopage_temp.#?';exit;BREAK_C:;do f=1 to max_con;if show(p,"HTTPJ." || f) then call closeport("HTTPJ." || f);say "PORT HTTPJ." || f "closed.";end;
-